import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { StudentDetailComponent } from './student-detail/student-detail.component';
import { StudentListComponent } from './student-list/student-list.component';
import { StudentComponent } from './student.component';
import { StudentResolver } from './student.resolver';

const routes: Routes = [
  {
      path: '',
      component: StudentComponent,
      children: [
          {
              path: 'detail/:id',
              data:{ title: 'Student-Detail'},
              component: StudentDetailComponent,
              resolve: {
                  data: StudentResolver
              }
          },
          {
              path: 'list',
              data:{ title: 'Student-List'},
              component: StudentListComponent,
          },
          {
              path: '**',
              redirectTo: 'list'
          }
      ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class Student2RoutingModule { }
